package edu.bit.water.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Repository;

import edu.bit.water.entity.Chart;
import edu.bit.water.entity.Column;
import org.springframework.web.bind.annotation.RequestParam;


@Mapper
@Repository
public interface ChartDao {
    //增加流程图数据
    int addChart(Chart chart);

    //删除流程图数据
    int deleteChart(int id);

    //修改流程图数据
    int updateChart(Chart chart) throws DuplicateKeyException;

    //查询所有流程图数据
    List<Chart> selectChart();

    List<Chart> selectChartByBusiness(int businessId);

    //查询单个流程图数据
    Chart selectOne(int id);

    //根据设备名称返回水量信息
    Map<String, Object> selectWater(String name);

    //返回水量元数据表中的英文字段和中文字段名
    List<Column> waterNameMatch();

    //返回设备元数据表中的英文字段名和中文字段名
    List<Column> sensorNameMatch();

    //如果流程图名存在则返回id值，否则返回空
    Integer selectChartName(String chartName);

    Chart selectByName(String name);

    //根据属性返回
    Map<String, Object> selectByProperty(Map<String, Object> map);

    Integer getMaxId();

    List<String> queryLocationByBusinessId(@Param("businessId") String businessId);

    List<String> querySensorTypeByLocation(@Param("businessId") String businessId, @Param("location") String location);

    List<String> querySensorIdByLocationAndType(@Param("businessId") String businessId, @Param("location") String location, @Param("sensorType") String sensorType);

    List<String> querySensorNameByBusinessId(@Param("businessId") String businessId);

    List<String> querySensorNoByName(@Param("businessId") String businessId, @Param("name") String name);
}
